import { getImToken} from '@/api/user.js'
import local from "./local"
import { getToken } from '@/utils/auth.js'


export default {
	getImToken(){
		
		return new Promise((resolve, reject) => {
			if(local.getImToken()){
				resolve(local.getImToken());
			}else{
				if(getToken()){
					getImToken().then(res=>{
						if(res.code==200){
							console.log("getImToken",res)
							local.setImToken(res.data.token);
							resolve(res.data.token);
						}else{
							resolve(false);
						}
					})
				}else{
					resolve(false);
				}
				
			}
			
			
		})
		
		
	}
}